﻿@using StackExchange.Opserver.Data.Redis
@model RedisInstance
@{
    Layout = null;
    var info = Model;
    var clients = info.Clients.SafeData();
}
@if (clients != null)
{
    <div class="info-title">Client Summary <span class="note">(by IP)</span></div>
    <div class="redis-client-summary">
        @{ var ips = clients.Select(c => c.Host).GroupBy(ip => ip); }
        @foreach (var ip in ips.OrderBy(ipg => ipg.Key))
        {
            var name = info.GetServerName(ip.Key);
            <div class="info-line"><span class="label">@ip.Key@(name.HasValue() ? " (" + name + ")" : "")</span> <span class="value">@ip.Count().ToComma()</span> <span class="value add-info conns">@ip.Count().Pluralize("connection", includeNumber: false)</span></div>
        }
    </div>
}